Optimal. Leaf size=127 \[ \frac {(a A+b B) \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {x (A b-a B)}{a^2+b^2}-\frac {a^3 (A b-a B) \log (a+b \tan (c+d x))}{b^3 d \left (a^2+b^2\right )}+\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.40, antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3607, 3647, 3626, 3617, 31, 3475} \[ -\frac {a^3 (A b-a B) \log (a+b \tan (c+d x))}{b^3 d \left (a^2+b^2\right )}+\frac {(a A+b B) \log (\cos (c+d x))}{d \left (a^2+b^2\right )}-\frac {x (A b-a B)}{a^2+b^2}+\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3475
Rule 3607
Rule 3617
Rule 3626
Rule 3647
Rubi steps
\begin {align*} \int \frac {\tan ^3(c+d x) (A+B \tan (c+d x))}{a+b \tan (c+d x)} \, dx &=\frac {B \tan ^2(c+d x)}{2 b d}+\frac {\int \frac {\tan (c+d x) \left (-2 a B-2 b B \tan (c+d x)+2 (A b-a B) \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{2 b}\\ &=\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d}+\frac {\int \frac {-2 a (A b-a B)-2 A b^2 \tan (c+d x)-2 \left (a A b-a^2 B+b^2 B\right ) \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{2 b^2}\\ &=-\frac {(A b-a B) x}{a^2+b^2}+\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d}-\frac {\left (a^3 (A b-a B)\right ) \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b^2 \left (a^2+b^2\right )}-\frac {(a A+b B) \int \tan (c+d x) \, dx}{a^2+b^2}\\ &=-\frac {(A b-a B) x}{a^2+b^2}+\frac {(a A+b B) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d}-\frac {\left (a^3 (A b-a B)\right ) \operatorname {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^3 \left (a^2+b^2\right ) d}\\ &=-\frac {(A b-a B) x}{a^2+b^2}+\frac {(a A+b B) \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}-\frac {a^3 (A b-a B) \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right ) d}+\frac {(A b-a B) \tan (c+d x)}{b^2 d}+\frac {B \tan ^2(c+d x)}{2 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 1.58, size = 138, normalized size = 1.09 \[ \frac {\frac {2 a^3 (a B-A b) \log (a+b \tan (c+d x))}{b^2 \left (a^2+b^2\right )}+\frac {2 (A b-a B) \tan (c+d x)}{b}-\frac {b (A+i B) \log (-\tan (c+d x)+i)}{a+i b}-\frac {b (A-i B) \log (\tan (c+d x)+i)}{a-i b}+B \tan ^2(c+d x)}{2 b d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.59, size = 190, normalized size = 1.50 \[ \frac {2 \, {\left (B a b^{3} - A b^{4}\right )} d x + {\left (B a^{2} b^{2} + B b^{4}\right )} \tan \left (d x + c\right )^{2} + {\left (B a^{4} - A a^{3} b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - {\left (B a^{4} - A a^{3} b - A a b^{3} - B b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (B a^{3} b - A a^{2} b^{2} + B a b^{3} - A b^{4}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{2} b^{3} + b^{5}\right )} d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.88, size = 135, normalized size = 1.06 \[ \frac {\frac {2 \, {\left (B a - A b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {{\left (A a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{4} - A a^{3} b\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b^{3} + b^{5}} + \frac {B b \tan \left (d x + c\right )^{2} - 2 \, B a \tan \left (d x + c\right ) + 2 \, A b \tan \left (d x + c\right )}{b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.23, size = 211, normalized size = 1.66 \[ \frac {B \left (\tan ^{2}\left (d x +c \right )\right )}{2 b d}+\frac {A \tan \left (d x +c \right )}{d b}-\frac {a B \tan \left (d x +c \right )}{b^{2} d}-\frac {a^{3} \ln \left (a +b \tan \left (d x +c \right )\right ) A}{d \,b^{2} \left (a^{2}+b^{2}\right )}+\frac {a^{4} B \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right ) d}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a A}{2 d \left (a^{2}+b^{2}\right )}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) B b}{2 d \left (a^{2}+b^{2}\right )}-\frac {A \arctan \left (\tan \left (d x +c \right )\right ) b}{d \left (a^{2}+b^{2}\right )}+\frac {B \arctan \left (\tan \left (d x +c \right )\right ) a}{d \left (a^{2}+b^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.78, size = 130, normalized size = 1.02 \[ \frac {\frac {2 \, {\left (B a - A b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {2 \, {\left (B a^{4} - A a^{3} b\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b^{3} + b^{5}} - \frac {{\left (A a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {B b \tan \left (d x + c\right )^{2} - 2 \, {\left (B a - A b\right )} \tan \left (d x + c\right )}{b^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.52, size = 144, normalized size = 1.13 \[ \frac {\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {A}{b}-\frac {B\,a}{b^2}\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-B+A\,1{}\mathrm {i}\right )}{2\,d\,\left (-b+a\,1{}\mathrm {i}\right )}+\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,a^4-A\,a^3\,b\right )}{d\,\left (a^2\,b^3+b^5\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )}{2\,d\,\left (a-b\,1{}\mathrm {i}\right )}+\frac {B\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,b\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 2.13, size = 1300, normalized size = 10.24 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________